package com.inossem.warehousestorage_inossem.request.changeStorage;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.changeStorage.ChangeStorageMaterielListBean;
import com.inossem.warehousestorage_inossem.bean.changeStorage.ChangeStorageMaterielListRequestBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * Created by leij on 2017/6/12.
 */

public class ChangeStorageMaterielListRequest extends Request {


    public static String request(Context context, ChangeStorageMaterielListRequestBean paramsBean, GsonBeanListener gsonBeanListener) {
        String tag;
        String url = RequestManage.getUrl(context,RequestConstant.URL_CHANGE_STORAGE_MATERIEL_LIST );
        Gson gson = new Gson();
        String params = gson.toJson(paramsBean, paramsBean.getClass());
        tag = RequestManage.getHttpsPostWithLoading(context, url,params, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                ChangeStorageMaterielListBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), ChangeStorageMaterielListBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }

}
